<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>getRegisteredObject()</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="api.functions.html" title="Chapter 14. Smarty Class Methods">
<link rel="prev" href="api.get.plugins.dir.html" title="getPluginsDir()">
<link rel="next" href="api.get.tags.html" title="getTags()">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">getRegisteredObject()</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="api.get.plugins.dir.html">Prev</a> </td>
<th width="60%" align="center">Chapter 14. Smarty Class Methods</th>
<td width="20%" align="right"> <a accesskey="n" href="api.get.tags.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="refentry" title="getRegisteredObject()">
<a name="api.get.registered.object"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>getRegisteredObject() — returns a reference to a registered object</p>
</div>
<div class="refsect1" title="Description">
<a name="id434278"></a><h2>Description</h2>
<code class="methodsynopsis"><span class="type">array </span><span class="methodname">getRegisteredObject</span>(<span class="methodparam"><span class="type">string </span><span class="parameter">object_name</span></span>);</code><p>
   This is useful
   from within a custom function when you need direct access to a
   <a class="link" href="api.register.object.html" title="registerObject()">registered object</a>. See the
   <a class="link" href="advanced.features.objects.html" title="Objects">objects</a> page for more info.
  </p>
<div class="example">
<a name="id434733"></a><p class="title"><b>Example 14.28. getRegisteredObject()</b></p>
<div class="example-contents"><pre class="programlisting">

&lt;?php
function smarty_block_foo($params, $smarty)
{
  if (isset($params['object'])) {
    // get reference to registered object
    $obj_ref = $smarty-&gt;getRegisteredObject($params['object']);
    // use $obj_ref is now a reference to the object
  }
}
?&gt;

   </pre></div>
</div>
<br class="example-break"><p>
  See also
  <a class="link" href="api.register.object.html" title="registerObject()"><code class="varname">registerObject()</code></a>,
  <a class="link" href="api.unregister.object.html" title="unregisterObject()"><code class="varname">unregisterObject()</code></a>
  and
  <a class="link" href="advanced.features.objects.html" title="Objects">objects page</a>
  </p>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="api.get.plugins.dir.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="api.functions.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="api.get.tags.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">getPluginsDir() </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> getTags()</td>
</tr>
</table>
</div>
</body>
</html>
